﻿using Springwater.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Springwater.DataAccessLayer.Repository
{
    public class FenykepRepository : GenericRepository<Fenykep>
    {
        public FenykepRepository(SWModelContainer context)
            : base(context)
        {
        }

        public void SetElsodleges(int borvizId, int fenykepId)
        {
            var borviz = this.context.Borviz.FirstOrDefault(b => b.Id == borvizId);
            
            if (borviz != null)
            {
                foreach (var fenykep in borviz.Fenykepek)
                {
                    fenykep.Elsodleges = (fenykep.Id == fenykepId);
                }
            }
        }
    }
}
